package moe.bogos.douro.api.common.soul.skill;

import javax.annotation.Nonnull;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

public interface SkillContainer extends Iterable<Skill>
{

    @Override
    public default Iterator<Skill> iterator()
    {
        return getSkills().iterator();
    }

    @Nonnull
    public Set<Skill> getSkills();

    public default Set<PassiveSkill> getPassiveSkills()
    {
        Set<PassiveSkill> passiveSkills = new HashSet<>();
        for (Skill skill : getSkills())
        {
            if (skill instanceof PassiveSkill)
            {
                passiveSkills.add((PassiveSkill) skill);
            }
        }
        return passiveSkills;
    }

    public default Set<ActiveSkill> getActiveSkills()
    {
        Set<ActiveSkill> activeSkills = new HashSet<>();
        for (Skill skill : getSkills())
        {
            if (skill instanceof ActiveSkill)
            {
                activeSkills.add((ActiveSkill) skill);
            }
        }
        return activeSkills;
    }
}
